home *** CD-ROM | disk | FTP | other *** search
- ; portio.asm - 8088 port I/O functions
- ;
- ; start data section
- include begdata.ha
- include enddata.ha
- ;
- ; start code section
- include begcode.ha
- ;
- ; inport - read a byte from an 8088 port
- ;
- ; USAGE: byte_value = inport(port_number) ;
- ;
- inport_args struc ; input arguments
- dw 0 ; saved BP value
- dw 0 ; return address
- iport dw 0 ; port number to read
- inport_args ends
- ;
- public inport
- inport:
- push bp
- mov bp,sp ; set our arg pointer
- mov dx,word ptr iport[bp] ; set up port address
- in al,dx
- xor ah,ah
- pop bp
- ret
- ;
- ; output - write a byte to an 8088 port
- ;
- ; USAGE: outport(byte_value,port_number) ;
- ;
- outport_args struc ; input arguments
- dw 0 ; saved BP value
- dw 0 ; return address
- byte_value dw 0 ; value to write
- oport dw 0 ; write to this port number
- outport_args ends
- ;
- public outport
- outport:
- push bp
- mov bp,sp ; set our arg pointer
- mov dx,word ptr oport[bp] ; get port address
- mov ax,word ptr byte_value[bp]
- out dx,al
- pop bp
- ret
- ;
- ;
- include endcode.ha
- end
-